import pymysql
def main():
    conn = pymysql.connect(host='',port=3306,
                           user='root',password='admin@9000',
                           database='my_database',charset='utf8')

    sql = """
       CREATE TABLE TB_EMP (	
	EMPNO INT PRIMARY KEY NOT NULL COMMENT '员工编号', 
	ENAME VARCHAR(10) COMMENT '姓名', 
	JOB VARCHAR(9) COMMENT '职位', 
	MGR INT COMMENT '领导编号', 
	HIREDATE DATE COMMENT '入职时间', 
	SAL DECIMAL(9,2) COMMENT '基本工资', 
	COMM DECIMAL(9,2) COMMENT '奖金', 
	DEPTNO INT COMMENT '部门编号'
) COMMENT='员工表';

       """
    try:
        with conn.cursor() as cursor:
            cursor.execute(sql)
    except pymysql.MySQLError as error:
        print(error)
    finally:
        conn.close()
    print("sql执行完毕")
if __name__ == '__main__':
    main()